﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Utility.Json;
using Utility.Model;
using Hxj.Data;
using Utility;

namespace MsgCenter.Web.Handlers
{
    /// <summary>
    /// Handler_Query 的摘要说明
    /// </summary>
    public class Handler_Query : BaseUI.BaseHandler
    {
        public void AuditMessage()
        {
            try
            {
                string strID = ParamsOfRequest.Request("SMSID");
                BLL.BLLServiceHelper.GetWriteService().AuditMessage(strID);
                base.GetSuccessJson();
            }
            catch (Exception ex)
            {
                base.GetFailureJson(ex.Message);
            }
        }

        public void GetQueryAuditList()
        {
            WhereClip wcp = new WhereClip();
            wcp = wcp.And(TB_SMS_Message._.Status == 2);
            var pageConditon = base.GetPageConditon(wcp);
            JsonJqGridData<TB_SMS_Message> gridList = BLL.BLLServiceHelper.GetBaseDataService().GetGridDataList<TB_SMS_Message>(pageConditon);
            string strResult = gridList.ToString();
            Response.Write(strResult);
        }


        public void GetQueryAdminSendList()
        {
            WhereClip wcp = new WhereClip();
            var pageConditon = base.GetPageConditon(wcp);
            JsonJqGridData<TB_SMS_Message> gridList = BLL.BLLServiceHelper.GetBaseDataService().GetGridDataList<TB_SMS_Message>(pageConditon);
            string strResult = gridList.ToString();
            Response.Write(strResult);
        }

        public void GetQueryMyReciveList()
        {
            WhereClip wcp = new WhereClip();
            wcp = wcp.And(TB_SMS_Message._.ReceiveLoginName == base.Account);
            var pageConditon = base.GetPageConditon(wcp);
            JsonJqGridData<TB_SMS_Message> gridList = BLL.BLLServiceHelper.GetBaseDataService().GetGridDataList<TB_SMS_Message>(pageConditon);
            string strResult = gridList.ToString();
            Response.Write(strResult);
        }

        public void GetQueryMySendList()
        {
            WhereClip wcp = new WhereClip();
            wcp = wcp.And(TB_SMS_Message._.SendLoginName == base.Account);
            var pageConditon = base.GetPageConditon(wcp);
            JsonJqGridData<TB_SMS_Message> gridList = BLL.BLLServiceHelper.GetBaseDataService().GetGridDataList<TB_SMS_Message>(pageConditon);
            string strResult = gridList.ToString();
            Response.Write(strResult);
        }

        public void GetQueryLogList()
        {
            WhereClip wcp = new WhereClip();
            var pageConditon = base.GetPageConditon(wcp);
            JsonJqGridData<TB_SMS_Log> gridList = BLL.BLLServiceHelper.GetBaseDataService().GetGridDataList<TB_SMS_Log>(pageConditon);
            string strResult = gridList.ToString();
            Response.Write(strResult);
        }
    }
}